<?php
namespace App\Common;

use PhalApi\Api;

/**
 * @name 重写Api
 * @author JiangYongWei
 *
 */

class MyApi extends Api
{
    private $Di;
    protected $Config = array();//应用配置
    protected $ThirdConfig = array();//第三方配置
    protected $Lang = array();//消息配置

    public function __construct()
    {
       /*  $default = array();
        $di = \PhalApi\DI();
        $this->Di = $di;
        $this->Config = $di->config->get('app.config', $default);
        $this->Lang = $di->config->get('lang.msgcode', $default); */
    }

    /**
     * 数据返回
     * @param unknown $res
     * @ignore
     */
    protected function output($res)
    {
        $code = isset($res['code']) ? intval($res['code']) : 0;//信息码
        $msg = isset($res['msg']) ? $res['msg'] : '';//信息
        $data = isset($res['data']) ? $res['data'] : array();//返回数据，为空系统默认过滤
        $rs = \PhalApi\DI()->response;
        $rs->setRet($code);
        $rs->setMsg($msg);
        return $data;
    }
}
